import 'package:flutter/cupertino.dart';
import 'package:learning_content_admin_pannel.core/core/presentation/theme/styles.dart';
import 'package:learning_content_admin_pannel.core/core/presentation/theme/theme.dart';

part 'theme/styles.dart';

part 'theme/text_theme.dart';

part 'theme/theme.dart';

part 'view.dart';

class AppTextField extends StatelessWidget {
  const AppTextField({
    required this.controller,
    required this.focusNode,
    this.autocorrect = true,
    this.enableSuggestions = true,
    this.placeholder,
    this.obscureText = false,
    this.keyboardType,
    this.textInputAction,
    this.autofillHints,
    this.onSubmitted,
    this.maxLines = 1,
    this.width,
    super.key,
  });

  final TextEditingController controller;
  final FocusNode focusNode;
  final String? placeholder;
  final bool autocorrect;
  final bool enableSuggestions;
  final bool obscureText;
  final TextInputType? keyboardType;
  final TextInputAction? textInputAction;
  final List<String>? autofillHints;
  final VoidCallback? onSubmitted;
  final int? maxLines;
  final double? width;

  @override
  Widget build(BuildContext context) {
    return _AppTextFieldTheme(
      brightness: CoreTheme.of(context).brightness,
      child: _AppTextFieldView(
        controller: controller,
        focusNode: focusNode,
        placeholder: placeholder,
        autocorrect: autocorrect,
        enableSuggestions: enableSuggestions,
        obscureText: obscureText,
        keyboardType: keyboardType,
        textInputAction: textInputAction,
        autofillHints: autofillHints,
        onSubmitted: onSubmitted,
        maxLines: maxLines,
        width: width,
      ),
    );
  }
}
